package com.source.barcodeMachineGrantAndRecovery.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.source.barcodeMachineGrantAndRecovery.VO.HouseMachineVO;
import com.source.barcodeMachineGrantAndRecovery.entity.HouseMachine;
import com.source.barcodeMachineGrantAndRecovery.mapper.HouseMachineMapper;
import com.source.barcodeMachineGrantAndRecovery.service.HouseMachineService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.source.baseData.entity.BarcodeMachine;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author IceBerg777
 * @since 2021-03-27
 */
@Service
public class HouseMachineServiceImpl extends ServiceImpl<HouseMachineMapper, HouseMachine> implements HouseMachineService {

    @Autowired
    HouseMachineMapper machineMapper;

    @Override
    public List<HouseMachineVO> findList() {
        return machineMapper.findList();
    }

    @Override
    public IPage<HouseMachineVO> findPages(Integer current, Integer size) {
        return machineMapper.findPages(new Page<>(current,size));
    }

    @Override
    public IPage<HouseMachineVO> findSimilar(String keyWord, Integer current, Integer size) {
        return machineMapper.findSimilar("%" + keyWord + "%",new Page<>(current,size));
    }

    @Override
    public List<BarcodeMachine> findUnSaved() {
        return machineMapper.findUnSaved();
    }

    @Override
    public HouseMachine find(String id) {
        return machineMapper.selectById(id);
    }
}
